home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kabc / ldifconverter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.3 KB  |  101 lines

  1. /*
  2.     This file is part of libkabc.
  3.     Copyright (c) 2003 Helge Deller <deller@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License version 2 only as published by the Free Software Foundation.
  8.  
  9.     This library is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.     Library General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU Library General Public License
  15.     along with this library; see the file COPYING.LIB.  If not, write to
  16.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.     Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef KABC_LDIFCONVERTER_H
  21. #define KABC_LDIFCONVERTER_H
  22.  
  23. #include <qstring.h>
  24. #include <qdatetime.h>
  25.  
  26. #include "addressee.h"
  27. #include "addresseelist.h"
  28.  
  29. namespace KABC {
  30.  
  31.   /**
  32.    * A set of functions to convert a string with LDIF information to addressees 
  33.    * and vice versa. It is useful for addressbook import- and exportfilters 
  34.    * and might be used to read and write Mozilla and Netscape addresssbooks.
  35.    */
  36.  
  37.   namespace LDIFConverter {
  38.  
  39.   /**
  40.    * Converts a LDIF string to a list of addressees.
  41.    *
  42.    * @param str         The vcard string.
  43.    * @param addrList    The addresseelist.
  44.    * @param dt          The date & time value of the last modification (e.g. file modification time).
  45.    * @since 3.2
  46.    */
  47.   KABC_EXPORT bool LDIFToAddressee( const QString &str, AddresseeList &addrList, QDateTime dt = QDateTime::currentDateTime() );
  48.  
  49.   /**
  50.    * Converts a list of addressees to a LDIF string.
  51.    *
  52.    * @param addrList    The addresseelist.
  53.    * @param str         The LDIF string.
  54.    * @since 3.2
  55.    */
  56.   KABC_EXPORT bool addresseeToLDIF( const AddresseeList &addrList, QString &str );
  57.  
  58.   /**
  59.    * Converts an addressee to a LDIF string.
  60.    *
  61.    * @param addr    The addressee.
  62.    * @param str     The LDIF string.
  63.    * @since 3.2
  64.    */
  65.   KABC_EXPORT bool addresseeToLDIF( const Addressee &addr, QString &str );
  66.  
  67.   /**
  68.    * @deprecated
  69.    * Obsoleted - please use LDIF::assembleLine()
  70.    * Returns a LDIF compatible string representing a given field/value pair.
  71.    * If necessary, the value parameter will be base64encoded and split into multiple.
  72.    * This function will return an empty string if the given value is empty.
  73.    *
  74.    * @param field   The LDAP field name or a complete LDIF field string (e.g. "cn" or "cn = %1\n").
  75.    * @param value   The value for this field.
  76.    * @param allowEncode Set to false if you wish no encoding of the value.
  77.    * @since 3.2
  78.    */
  79.   KABC_EXPORT QString makeLDIFfieldString( QString field, QString value, bool allowEncode = true ) KDE_DEPRECATED;
  80.  
  81.  
  82.  
  83.   /* internal functions - do not use !! */
  84.   
  85.   /** No need for this function anymore - use LDIF::splitLine() + evaluatePair() */
  86.   KABC_EXPORT bool parseSingleLine( Addressee &a,
  87.         Address &homeAddr, Address &workAddr, QString &line );
  88.  
  89.   /** No need for this function anymore - use LDIF::splitLine() */
  90.   KABC_EXPORT bool splitLine( QString &line, QString &fieldname, QString &value);
  91.  
  92.  
  93.   KABC_EXPORT bool evaluatePair( Addressee &a, Address &homeAddr, Address &workAddr,
  94.     QString &fieldname, QString &value );
  95.  
  96.   }
  97.  
  98. }
  99. #endif
  100.  
  101.